package com.chixing.ih.module.admin.mapper;

import com.chixing.ih.module.admin.mapper.Provider.AdminOrderMapperProvider;
import com.chixing.ih.module.admin.pojo.dto.OrderUserTaskDTO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminOrderMapper {

    @SelectProvider(type = AdminOrderMapperProvider.class, method = "getSettlementingOrder")
    @Results(id = "OUT", value = {
            @Result(column = "order_id", property = "orderId"),
            @Result(column = "order_num", property = "orderNum"),
            @Result(column = "order_status", property = "orderStatus"),
            @Result(column = "send_user", property = "sendUser"),
            @Result(column = "receive_user", property = "receiveUser"),
            @Result(column = "task_id", property = "taskId"),
            @Result(column = "task_title", property = "taskTitle"),
            @Result(column = "salary", property = "salary")
    })
    List<OrderUserTaskDTO> getSettlementingOrder(String keyword);


    @SelectProvider(type = AdminOrderMapperProvider.class, method = "getRefusingOrder")
    @ResultMap("OUT")
    List<OrderUserTaskDTO> getRefusingOrder(String keyword);



    @SelectProvider(type = AdminOrderMapperProvider.class, method = "getCompletedOrder")
    @ResultMap("OUT")
    List<OrderUserTaskDTO> getCompletedOrder();

    @SelectProvider(type = AdminOrderMapperProvider.class, method = "getRefundedOrder")
    @ResultMap("OUT")
    List<OrderUserTaskDTO> getRefundedOrder();


    @UpdateProvider(type = AdminOrderMapperProvider.class, method = "agreeToSettlement")
    boolean agreeToSettlement(Integer id);

    @UpdateProvider(type = AdminOrderMapperProvider.class, method = "agreeToRefund")
    boolean agreeToRefund(Integer id);

    @UpdateProvider(type = AdminOrderMapperProvider.class, method = "setIsDeleted")
    boolean setIsDeleted(Integer id);

    @SelectProvider(type = AdminOrderMapperProvider.class, method = "getAllOrder")
    @Results(id = "orderMap", value = {
            @Result(column = "order_num", property = "orderNum"),
            @Result(column = "task_title", property = "taskTitle"),
            @Result(column = "order_status", property = "orderStatus"),
            @Result(column = "send_user", property = "sendUser"),
            @Result(column = "receive_user", property = "receiveUser"),
            @Result(column = "talent_categories", property = "talentCategory"),
            @Result(column = "work_way", property = "operationMode"),
            @Result(column = "requirement_description", property = "requirementsDescription"),
            @Result(column = "technology", property = "skillsRequirements"),
            @Result(column = "salary", property = "salary"),
            @Result(column = "work_cycle", property = "workCycle"),
            @Result(column = "order_begin_time", property = "orderBeginTime"),
            @Result(column = "order_end_time", property = "orderEndTime"),
            @Result(column = "publishing_name", property = "isSuerName"),
            @Result(column = "publishing_phone", property = "isSuerTelephone")
    })
    List<OrderUserTaskDTO> getAllOrder(String keyword);


}












